/**
 * Bitset 输入一个十进制数字，输出他的二进制数字
 */
#include <iostream>
#include <stdexcept>

using namespace std;

template<typename T>
class Stack
{
    struct Node 
    {
        T data;
        Node *next;
        Node(T t) : data(t), next(nullptr) {}
        Node(T t, Node *n) : data(t), next(n) {}
    };
private:
    Node *head;
    int size;
    
public:
    Stack() : head(nullptr), size(0) {}
    ~Stack();

    // 入
    void push(T element);
    // 出
    T pop();
    // 获取栈顶元素
    T top() const;
    // 获取元素个数
    int getSize() const;
};

template<typename T>
Stack<T>::~Stack()
{
    while (head)
    {
        Node *pDel = head;
        head = head->next;
        delete pDel;
    }
}

template<typename T>
void Stack<T>::push(T element)
{
    Node *newNode = new Node(element, head);
    head = newNode;
    size++;
}

template<typename T>
T Stack<T>::pop()
{
    if (!head) 
    {
        throw std::underflow_error("Stack is empty");
    }
    T ret = head->data;
    Node *pPopNode = head;
    head = head->next;
    delete pPopNode;
    size--;
    return ret;
}

template <typename T>
T Stack<T>::top() const
{
    if (head == nullptr)
    {
        throw std::underflow_error("Stack is empty");
    }
    return head->data;
}

template <typename T>
int Stack<T>::getSize() const
{
    return size;
}

int main()
{
    int n;
    while (cin >> n)
    {
        Stack<int> stk;
        while (n)
        {
            stk.push(n % 2);
            n /= 2;
        }
        while (stk.getSize())
        {
            cout << stk.pop() << " ";
        }
    }
}